<?php
/**
 * Bảng Subscriber dùng để lưu thông tin những người đăng ký nhận thông tin qua email
 */
class Subscriber extends EMongoDocument {
	public $email = "";
	public $member_id = "";
	public $active = true;

	public static function model($className=__CLASS__){
		return parent::model($className);
	}

	// This method is required!
	public function getCollectionName(){
		return 'tbl_subscriber';
	}

	public function rules(){
		$rules = array();
		return $rules;
	}

	public function updateSubcriber($email,$member_id = null){
		if($this->isNewRecord){
			$this->email = $this->email;
			if(!empty($member_id)){
				$this->member_id = $member_id;
			}
			return $this->insert();
		}else{

		}
	}
}
?>